//首页
const express = require('express')
//引入连接池
const pool = require('../pool')
const router = express.Router()

router.get('/jd_Hotel/', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_Hotel', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询', data: r })
    })
})
router.get('/jd_hotel_detail/1', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 0,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '曼谷', data: r })
    })
})
router.get('/jd_hotel_detail/2', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 8,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '洛杉矶', data: r })
    })
})
router.get('/jd_hotel_detail/3', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 16,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '纽约', data: r })
    })
})
router.get('/jd_hotel_detail/4', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 24,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '纽约', data: r })
    })
})
router.get('/jd_hotel_detail/5', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 32,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '纽约', data: r })
    })
})
router.get('/jd_hotel_detail/6', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 40,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '纽约', data: r })
    })
})
router.get('/jd_hotel_detail/7', (req, res, next) => {
    var obj = req.query
    pool.query('select * from jd_hotel_detail limit 48,8 ', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '纽约', data: r })
    })
})
router.get('/movie_place', (req, res, next) => {
    var obj = req.query
    pool.query('select * from movie_place', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '电影地点', data: r })
    })
})
router.get('/hot_country_hotel', (req, res, next) => {
    var obj = req.query
    pool.query('select * from hot_country_hotel', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
router.get('/hot_city_hotel', (req, res, next) => {
    var obj = req.query
    pool.query('select * from hot_city_hotel', [obj.aid], (err, r) => {
        if (err) {
            return next(err)
        }
        res.send({ code: 200, msg: '查询成功', data: r })
    })
})
module.exports = router